package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 虎哥
 * @since 2021-12-22
 */
@RestController
@RequestMapping("/follow")
@Slf4j
@RequiredArgsConstructor
public class FollowController {
    private final IFollowService followService;
      /**
        * 实现关注好友功能
        * */
     @PutMapping("/{id}/{isFollow}")
     public Result follow(@PathVariable("id") Long followId, @PathVariable("isFollow") Boolean isFollow){
       return followService.follow(followId,isFollow);
     }
     /**
      * 实现查看是否关注功能
      * */
     @GetMapping("/or/not/{id}")
     public Result isFollow(@PathVariable("id") Long followId){
       return followService.isFollow(followId);
     }
     /**
      * 实现共同关注功能
      * */
     @GetMapping("/common/{id}")
     public Result followCommons(@PathVariable("id") Long id){
       return followService.followCommons(id);
     }
}
